<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试loadHistoryMessages</title>
</head>
<body>
    <h1>测试loadHistoryMessages方法</h1>
    <button id="testButton">测试loadHistoryMessages</button>
    <div id="output"></div>

    <script>
        document.getElementById('testButton').addEventListener('click', async () => {
            const output = document.getElementById('output');
            output.innerHTML = '<p>开始测试...</p>';
            
            try {
                // 模拟调用loadHistoryMessages方法
                const sessionId = '765fc24e-7908-43ac-a934-0e5ae1105f10';
                output.innerHTML += `<p>会话ID: ${sessionId}</p>`;
                
                // 发送API请求
                const response = await fetch(`http://localhost:8000/v1/sessions/${sessionId}/messages`);
                output.innerHTML += `<p>响应状态: ${response.status}</p>`;
                
                if (response.ok) {
                    const data = await response.json();
                    output.innerHTML += `<p>响应数据: ${JSON.stringify(data, null, 2)}</p>`;
                } else {
                    output.innerHTML += `<p>请求失败: ${response.statusText}</p>`;
                }
            } catch (error) {
                output.innerHTML += `<p>错误: ${error.message}</p>`;
            }
        });
    </script>
</body>
</html>